import requset from "@/utils/request";
import qs from "qs";

    enum URL {
        SystemMenu = '/v1/admin/system/menu/index',
        AddMenu = '/v1/admin/system/menu/insert',
        UpdateMenu = '/v1/admin/system/menu/update',
        DisabledMenu = '/v1/admin/system/menu/disable',
        DeletedMenu = '/v1/admin/system/menu/delete'
    }

    const sysMenuList = async () => requset<Partial<APISYSTEMMENU.SysMenuItem>[]>({ url: URL.SystemMenu, method:"GET", })
    const sysAddMenu = async (data:APISYSTEMMENU.AddMenu) => requset({ url: URL.AddMenu,method:"POST",  data:qs.stringify(data) })
    const sysUpdateMenu = async (data:APISYSTEMMENU.UpdateMenu) => requset({ url: URL.UpdateMenu,method:"PUT",  data:qs.stringify(data) })
    const DisabledMenu = async (data:APISYSTEMMENU.DisableMenu) => requset({ url: URL.DisabledMenu,method:"POST",  data:qs.stringify(data) })
    const DeletedMenu = async (data:APISYSTEMMENU.DeleteMenu) => requset({ url: URL.DeletedMenu,method:"DELETE",  data:data })

    export default { sysMenuList,sysAddMenu,sysUpdateMenu,DisabledMenu,DeletedMenu };
